"""SuperMarket URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
from django.urls import path, re_path
from django.views.static import serve
from SuperMarket.settings import MEDIA_ROOT

from system import views
from SuperMarket.Views import testViews,goodsTypeViews,goodsUnitViews,LevelViews,menuViews,goodsViews,orderViews,homeViews

urlpatterns = [
    path('admin/', admin.site.urls),
    # 添加对媒体文件url的解释
    re_path(r"^upload/(?P<path>.*)$",serve,{"document_root":MEDIA_ROOT}),

    url(r'^login$',views.login,name='login'),   # 登录
    url(r'^register$',views.register,name='register'),   # 注册
    url(r'^showlog$',views.showLog,name='showlog'),    # 查看日志
    url(r'^userinfo$',views.userInfo,name='userinfo'),   # 用户信息
    url(r'^deleteuser$', testViews.deleteUser, name='deleteuser'),  #删除用户
    url(r'^editpassword$',views.editUserPassword,name='editpassword'),  #修改密码
    url(r'^edituerstatus$',views.editUerStatus,name='edituerstatus'),  #修改用户状态
    url(r'edituserinfo$',views.editUserInfo,name='edituserinfo'),   #修改用户信息

    url(r'^goods/addtype$',goodsTypeViews.addGoodsType,name="addgoodstype"),   # 添加商品类别
    url(r'^goods/typesinfo$',goodsTypeViews.GoodsTypesInfo,name='goodstypeinfo'),   # 查看商品类别
    url(r'^gettypedata$',goodsTypeViews.getTypeData,name="gettypedata"),  # 获取商品类别(分页)
    url(r'^goods/deletetype$',goodsTypeViews.deleteGoodsType,name='deletetype'),   # 删除商品类别
    url(r'^goods/edittype$',goodsTypeViews.deitGoodsType,name='edittype'),    # 修改商品类别

    url(r'^goods/addunit$',goodsUnitViews.addGoodsUnit,name="addunit"),   # 添加商品单位
    url(r'^goods/deleteunit$',goodsUnitViews.deleteGoodsUnit,name='deleteunit'),   # 删除商品单位
    url(r'^goods/unitinfo$',goodsUnitViews.GoodsUnitInfo,name='unitinfo'),   # 查看商品单位
    url(r'^getunitdata$',goodsUnitViews.getUnitData,name="getunitdata"),  # 获取商品单位(分页)
    url(r'^goods/editunit$',goodsUnitViews.editGoodsUnit,name='editunit'),   # 修改商品单位

    url(r'^addlevel$',LevelViews.addLevel,name="addlevel"),   # 添加角色权限
    url(r'^deletelevel$',LevelViews.deleteLevel,name='deletelevel'),   # 删除角色权限
    url(r'^levelinfo$',LevelViews.LevelInfo,name='levelinfo'),   # 查看角色权限
    url(r'^editlevel$',LevelViews.editLevel,name='editlevel'),   # 修改角色权限
    url(r'^getleveldata$',LevelViews.getLevelData,name="getleveldata"),  # 获取角色权限(分页)

    url(r'^addmenu$',menuViews.addMenu,name="addmenu"),   # 添加菜单
    url(r'^deletemenu$',menuViews.deleteMenu,name='deletemenu'),   # 删除菜单
    url(r'^menuinfo$',menuViews.MenuInfo,name='menuinfo'),   # 查看菜单列表
    url(r'^getmenu$',menuViews.getMenu,name='getmenu'),  #查看菜单信息
    url(r'^editmenu$',menuViews.editMenu,name='editmenu'),   # 修改菜单
    url(r'^addmenulevel$',menuViews.addMenuLevel,name="addmenulevel"),   # 添加角色菜单
    url(r'^deletemenulevel$',menuViews.deleteMenuLevel,name='deletemenulevel'),   # 删除角色菜单
    url(r'^menulevelinfo$',menuViews.MenuLevelInfo,name='menulevelinfo'),   # 查看角色菜单
    url(r'^editmenulevel$',menuViews.editMenuLevel,name='editmenulevel'),   # 修改角色菜单
    url(r'^levelmenuinfo$',menuViews.LevelMenuInfo,name='levelmenuinfo'),   # 查看角色菜单
    url(r'^getlevelmenu$',menuViews.GetLevelMenu,name='getlevelmenu'),  # 获取角色菜单(list格式)
    url(r'^addlevelmenu$',menuViews.AddLevelMenu,name='addlevelmenu'),   # 添加角色菜单
    url(r'^deletelevelmenu$',menuViews.DeleteLevelMenu,name='deletelevelmenu'),   # 删除角色菜单

    url(r'^getgoodsdata$',goodsViews.getGoodsData,name='getgoodsdata'),  #查看商品数据
    url(r'^changegoodsshelves$',goodsViews.changeGoodsShelves,name='changegoodsshelves'),  #修改商品是否上架
    url(r'^getgoods$',goodsViews.getGoods,name='getgoods'),  #查询单个商品
    url(r'^addgoods$',goodsViews.addGoods,name='addgoods'),  #添加商品
    url(r'^pic$',goodsViews.upPic,name='pic'),  #添加商品图片
    url(r'^deletegoods$',goodsViews.deleteGoods,name='deletegoods'),  #添加商品图片
    url(r'^editgoods$',goodsViews.editGoods,name='editgoods'),   # 修改商品
    url(r'^getgoodsofselect$',goodsViews.getGoodsOfSelect,name='getgoodsofselect'),  # 获取select用的商品

    url(r'^addorder$',orderViews.addOrder,name='addorder'),  # 手动添加订单
    url(r'^autoaddorder$',orderViews.autoAddOrder,name='autoaddorder'),  # 自动添加订单
    url(r'^orderinfo$',orderViews.getOrderData,name='orderinfo'),  # 自动添加订单
    url(r'^deleteorder$',orderViews.deleteOrder,name='deleteorder'),  # 删除订单
    url(r'^getorderdata$',orderViews.getOrderData,name='getorderdata'),  # 获取订单数据(分页)

    url(r'^orderlist$',homeViews.orderList,name='orderlist'),   #销售排行榜
    url(r'^getgoodsnum$',homeViews.getGoodsNum,name='getgoodsnum'),   # 获取商品数量
    url(r'^getordernum$',homeViews.getOrderNum,name='getordernum'),   # 获取商品数量
    url(r'^getdayorder$',homeViews.getDayOrder,name='getdayorder'),   # 按天获取销售额
    url(r'^gettypeorder$',homeViews.getTypeOrder,name='gettypeorder'),   # 获取每个种类的商品销售情况
    url(r'^gettypegoods$',homeViews.getTypeGoods,name='gettypegoods'),   # 获取商品结构
    url(r'^getgoodsinventory$',homeViews.getGoodsInventory,name='getgoodsinventory'),   # 获取商品库存
]
